package com.cn.product.service;

import com.cn.api.TestCoreService;
import com.cn.dto.ProductDTO;
import com.cn.product.entity.Product;
import com.cn.product.mapper.ProductMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/test")
public class TestCoreServiceImpl implements TestCoreService {
    @Autowired
    private ProductMapper productMapper;

//    @Autowired
//    private Jedis jedis;


//    @Before
//    public void init() {
//        jedis = new Jedis("127.0.0.1", 6379);
//    }

    //修改产品信息
    @Override
    @PostMapping("/modification")
    public int modification(ProductDTO productDTO) {
        System.out.println("lskdf张家口附近上空的飞机数量的咖啡机");
        log.info("\n实现层*********************");
//        jedis = new Jedis("127.0.0.1", 6379);
        Product product = new Product();
        product.setId(productDTO.getId());
        product.setType(productDTO.getType());
        int re = productMapper.update(product);


        return  re;
    }


}
